package org.layuiframework.generator.config;

import org.layuiframework.generator.config.es.EsStrategy;

public class LayuiGlobalConfig {

    public static boolean FUUL_COMMENT = true;
    public static String LAYUI_PUBLIC_KEY = "";
    public static String LAYUI_PRIVATE_KEY = "";
    public static String LAYUI_USER_FIELD = "layui-user-field";
    public static String ES_URIS;
    public static String ES_USERNAME;
    public static String ES_PASSWORD;
    public static String ES_STRATEGY = EsStrategy.CANAL.getStrategy();

    /**
     * @method 设置 Elasticsearch 配置
     * @param uris  访问地址 eg.http://localhost:9200
     * @param username 用户名 eg. root
     * @param password 密码 eg. 123456
     */
    public static void enableEs(String uris, String username, String password){
        ES_URIS = uris;
        ES_USERNAME = username;
        ES_PASSWORD = password;
    }

    /**
     * @method 设置 Elasticsearch 配置
     * @param uris  访问地址 eg.http://localhost:9200
     * @param username 用户名 eg. root
     * @param password 密码 eg. 123456
     * @param strategy es同步策略, 默认是用户自己去使用canal实现同步
     */
    public static void enableEs(String uris, String username, String password, EsStrategy strategy){
        enableEs(uris, username, password);
        ES_STRATEGY = strategy.getStrategy();
    }

}
